package com.csweimei.rentmanagementtreasure.enterprise.viewModel;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.csweimei.rentmanagementtreasure.http.entity.JoinListBean;

import me.goldze.mvvmhabit.base.BaseViewModel;
import me.goldze.mvvmhabit.base.MultiItemViewModel;
import me.goldze.mvvmhabit.binding.command.BindingAction;
import me.goldze.mvvmhabit.binding.command.BindingCommand;

public class JoinListItemVM extends MultiItemViewModel {
    JoinListVM joinListVM;

    public JoinListItemVM(@NonNull BaseViewModel viewModel) {
        super(viewModel);
        joinListVM = (JoinListVM) viewModel;
    }

    public ObservableField<JoinListBean.DataDTO> entity = new ObservableField<>();

    public void setData(JoinListBean.DataDTO bean) {
        entity.set(bean);
    }

    public BindingCommand cancel = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            joinListVM.handle(entity.get().getId()+"","0");
        }
    });

    public BindingCommand sure = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            joinListVM.handle(entity.get().getId()+"","1");
        }
    });


}


